<html>
<head><meta charset="utf-8"><title>Debugging rustdoc with gdb -- no debug symbols? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html">Debugging rustdoc with gdb -- no debug symbols?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216805594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805594">(Nov 15 2020 at 18:06)</a>:</h4>
<p>Hi there -- I'm new to contributing to the compiler but not new to using gdb. I have used <code>./x.py build</code> to build the rust project, and my config.toml contains:</p>
<div class="codehilite"><pre><span></span><code>profile = &quot;compiler&quot;
changelog-seen = 2
</code></pre></div>
<p>When I load the stage1 rustdoc binary into gdb, it complains that there are no debug symbols. Running <code>objdump --syms</code> on the binary suggests this is not the case, and I would expect debug symbols to be built by default. Am I missing something? This is making it really difficult for me to figure out the issue I'm working on! Thanks a lot anyone who can help :)</p>
<p>I'm on Ubuntu 20.04, using gdb 9.1.</p>



<a name="216805607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805607">(Nov 15 2020 at 18:06)</a>:</h4>
<p><span class="user-mention" data-user-id="364505">@Hannah McLaughlin</span> you need <code>debuginfo = 2</code></p>



<a name="216805612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805612">(Nov 15 2020 at 18:06)</a>:</h4>
<p>but be warned that's like 3 GB of debuginfo, it takes way longer to compile</p>



<a name="216805625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805625">(Nov 15 2020 at 18:06)</a>:</h4>
<p>Ah great! Is that in the config.toml? And thanks for the heads up about the compilation time!</p>



<a name="216805627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805627">(Nov 15 2020 at 18:06)</a>:</h4>
<p>if you use <code>debug = true</code> instead it will be a lot faster, but you won't have local variables</p>



<a name="216805638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805638">(Nov 15 2020 at 18:07)</a>:</h4>
<p>yeah, it says in config.toml.example what section it goes in (I don't remember off the top of my head)</p>



<a name="216805642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805642">(Nov 15 2020 at 18:07)</a>:</h4>
<p>unfortunately it will also rebuild the compiler</p>



<a name="216805643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805643">(Nov 15 2020 at 18:07)</a>:</h4>
<p>Cheers!</p>



<a name="216805783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805783">(Nov 15 2020 at 18:11)</a>:</h4>
<p>also, I'm curious what issue you're working on, I might be able to point you in the right direction</p>



<a name="216805867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805867">(Nov 15 2020 at 18:13)</a>:</h4>
<p>Sure, I think we might have spoken briefly on Github when I took it up :)  <a href="https://github.com/rust-lang/rust/issues/78777">https://github.com/rust-lang/rust/issues/78777</a></p>



<a name="216805909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805909">(Nov 15 2020 at 18:14)</a>:</h4>
<p>I made the suggested change the other week, but it causes an ICE when running with the example given in the issue -- hence the need for debugging!</p>



<a name="216805911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805911">(Nov 15 2020 at 18:14)</a>:</h4>
<p>I'll just get a diff and backtrace, if that is helpful</p>



<a name="216805924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805924">(Nov 15 2020 at 18:14)</a>:</h4>
<p>rustdoc is kind of a mess so I wouldn't be surprised if that broke other things <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="216805947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805947">(Nov 15 2020 at 18:15)</a>:</h4>
<p>the other way is to include <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def/enum.DefKind.html#variant.ForeignTy"><code>ForeignTy</code></a> and that sort of thing explicitly, but it's easy to forget a variant (like I did)</p>



<a name="216805950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805950">(Nov 15 2020 at 18:16)</a>:</h4>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs</span>
<span class="gh">index 8be9482acff..c4b7086fdb1 100644</span>
<span class="gd">--- a/src/librustdoc/passes/collect_intra_doc_links.rs</span>
<span class="gi">+++ b/src/librustdoc/passes/collect_intra_doc_links.rs</span>
<span class="gu">@@ -433,8 +433,9 @@ impl&lt;'a, 'tcx&gt; LinkCollector&lt;'a, 'tcx&gt; {</span>
             Res::PrimTy(prim) =&gt; Some(
                 self.resolve_primitive_associated_item(prim, ns, module_id, item_name, item_str),
             ),
<span class="gd">-            Res::Def(DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::TyAlias, did) =&gt; {</span>
<span class="gi">+            Res::Def(kind, did) if kind.ns() == Some(Namespace::TypeNS) =&gt; {</span>
                 debug!("looking for associated item named {} for item {:?}", item_name, did);
<span class="gi">+</span>
                 // Checks if item_name belongs to `impl SomeItem`
                 let assoc_item = cx
                     .tcx
</code></pre></div>



<a name="216805993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216805993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216805993">(Nov 15 2020 at 18:16)</a>:</h4>
<p>Of course my code could be entirely wrong! Backtrace coming now</p>



<a name="216806006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806006">(Nov 15 2020 at 18:17)</a>:</h4>
<div class="codehilite"><pre><span></span><code>build/x86_64-unknown-linux-gnu/stage1/bin/rustdoc test.rs                                   0 &lt; 18:15:25
thread &#39;rustc&#39; panicked at &#39;called `Option::unwrap()` on a `None` value&#39;, compiler/rustc_metadata/src/rmeta/decoder.rs:949:43
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&amp;template=ice.md

note: rustc 1.49.0-dev running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [type_of] computing type of `std::os::unix::process::CommandExt`
end of query stack
</code></pre></div>
<p>where <a href="http://test.rs">test.rs</a> is:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(extern_types)]</span><span class="w"></span>

<span class="k">extern</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// The extern type Foo.</span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">type</span> <span class="nc">Foo</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="sd">/// The struct Bar.</span>
<span class="k">pub</span><span class="w"> </span><span class="k">struct</span> <span class="nc">Bar</span><span class="p">;</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// Does stuff</span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">do_it</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>

<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">Bar</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="sd">/// This does stuff too</span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">do_it</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>

<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="sd">/// See also [Foo::do_it]</span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>

<span class="p">}</span><span class="w"></span>

<span class="sd">/// See also [Bar::do_it]</span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>

<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="216806013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806013">(Nov 15 2020 at 18:17)</a>:</h4>
<p>d'oh! forgot to actually get backtrace...</p>



<a name="216806059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806059">(Nov 15 2020 at 18:18)</a>:</h4>
<div class="codehilite"><pre><span></span><code>RUST_BACKTRACE=1 build/x86_64-unknown-linux-gnu/stage1/bin/rustdoc test.rs                 fish-0 | 1 &lt; 18:12:37
thread &#39;rustc&#39; panicked at &#39;called `Option::unwrap()` on a `None` value&#39;, compiler/rustc_metadata/src/rmeta/decoder.rs:949:43
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: rustc_metadata::rmeta::decoder::&lt;impl rustc_metadata::creader::CrateMetadataRef&gt;::get_type
   4: rustc_metadata::rmeta::decoder::cstore_impl::provide_extern::type_of
   5: rustc_middle::ty::query::&lt;impl rustc_query_system::query::config::QueryAccessors&lt;rustc_middle::ty::context::TyCtxt&gt; for rustc_middle::ty::query::queries::type_of&gt;::compute
   6: rustc_query_system::dep_graph::graph::DepGraph&lt;K&gt;::with_task_impl
   7: rustc_data_structures::stack::ensure_sufficient_stack
   8: rustc_query_system::query::plumbing::get_query_impl
   9: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve
  10: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve_link
  11: &lt;rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder&gt;::fold_item
  12: &lt;alloc::vec::Vec&lt;T&gt; as alloc::vec::SpecFromIter&lt;T,I&gt;&gt;::from_iter
  13: rustdoc::fold::DocFolder::fold_crate
  14: rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links
  15: rustc_session::utils::&lt;impl rustc_session::session::Session&gt;::time
  16: rustdoc::core::run_global_ctxt
  17: rustc_interface::passes::QueryContext::enter
  18: rustc_session::utils::&lt;impl rustc_session::session::Session&gt;::time
  19: rustc_interface::queries::&lt;impl rustc_interface::interface::Compiler&gt;::enter
  20: rustc_span::with_source_map
  21: rustc_interface::interface::create_compiler_and_run
  22: rustdoc::core::run_core
  23: rustdoc::main_options
  24: scoped_tls::ScopedKey&lt;T&gt;::set
  25: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&amp;template=ice.md

note: rustc 1.49.0-dev running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [type_of] computing type of `std::os::unix::process::CommandExt`
end of query stack
</code></pre></div>



<a name="216806061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806061">(Nov 15 2020 at 18:18)</a>:</h4>
<p>hmm, this looks like <a href="https://github.com/rust-lang/rust/issues/78236">https://github.com/rust-lang/rust/issues/78236</a></p>



<a name="216806064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806064">(Nov 15 2020 at 18:18)</a>:</h4>
<p>except it's coming from intra-doc links</p>



<a name="216806074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806074">(Nov 15 2020 at 18:19)</a>:</h4>
<p>btw, I'm not sure if you've discovered the logging yet - <code>RUSTDOC_LOG=rustdoc::passes::collect_intra=debug</code> is super helpful</p>



<a name="216806194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806194">(Nov 15 2020 at 18:22)</a>:</h4>
<p>anyway, this panic is weird, it should be returning <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.TyKind.html#variant.Error">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.TyKind.html#variant.Error</a> instead</p>



<a name="216806213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806213">(Nov 15 2020 at 18:22)</a>:</h4>
<p>just having a wee read</p>



<a name="216806919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806919">(Nov 15 2020 at 18:38)</a>:</h4>
<p>Thanks for the logging tip, I'm not sure if this is useful:</p>
<div class="codehilite"><pre><span></span><code>2:rustcDEBUG rustdoc::passes::collect_intra_doc_links saw kind ForeignTy with disambiguator None
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=See also [Bar::do_it]
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links resolving Bar::do_it as a macro in the module DefId(0:0 ~ test[8787])
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links Bar::do_it resolved to Err(()) in namespace TypeNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links Bar resolved to Ok((Path { span: test.rs:1:1: 1:1 (#0), segments: [PathSegment { ident: Bar#0, id: NodeId(59), args: None }], tokens: None }, Def(Struct, DefId(0:5 ~ test[8787]::
Bar)))) in namespace TypeNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links looking for associated item named do_it for item DefId(0:5 ~ test[8787]::Bar)
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links considering traits {}
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links the candidates were []
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links got associated item kind None
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links Bar::do_it resolved to Err(()) in namespace ValueNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links Bar resolved to Ok((Path { span: test.rs:1:1: 1:1 (#0), segments: [PathSegment { ident: Bar#0, id: NodeId(62), args: None }], tokens: None }, Def(Struct, DefId(0:5 ~ test[8787]::
Bar)))) in namespace TypeNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links looking for associated item named do_it for item DefId(0:5 ~ test[8787]::Bar)
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links intra-doc link to Bar::do_it resolved to Def(Struct, DefId(0:5 ~ test[8787]::Bar))
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links saw kind Struct with disambiguator None
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=The extern type Foo.
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Does stuff
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=This does stuff too
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Searches for [`char`]s that match the given predicate.
</code></pre></div>
<p>I guess the <code>rustcDEBUG rustdoc::passes::collect_intra_doc_links Bar::do_it resolved to Err(()) in namespace TypeNS</code> line is probably most relevant though I'm not sure it unveils too many mysteries! I'll try and have a read through the other calls in the backtrace to try and understand why that Err might not be handled correctly/cause the panic on None. I can do it while my debug info builds!</p>
<p>I think it was actually <code>debuginfo-level = 2</code> for anyone coming to this thread for the gdb issue, rather than <code>debuginfo</code> alone :)</p>



<a name="216806950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806950">(Nov 15 2020 at 18:39)</a>:</h4>
<p>oh hmm is that a primitive it crashes on? that's useful info</p>



<a name="216806966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216806966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216806966">(Nov 15 2020 at 18:39)</a>:</h4>
<p>try a test with <code>/// link to [char]</code></p>



<a name="216807043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216807043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216807043">(Nov 15 2020 at 18:40)</a>:</h4>
<blockquote>
<p>2:rustcDEBUG rustdoc::passes::collect_intra_doc_links intra-doc link to Bar::do_it resolved to Def(Struct, DefId(0:5 ~ test[8787]::Bar))</p>
</blockquote>
<p>this is also relevant, it means once you fix the ICE the original bug will be fixed too :)</p>



<a name="216807050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216807050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216807050">(Nov 15 2020 at 18:40)</a>:</h4>
<p>hooray!</p>



<a name="216807072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216807072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216807072">(Nov 15 2020 at 18:41)</a>:</h4>
<p>I feel foolish but I do not know what "try a test with <code>/// link to [char]</code>" means <span aria-label="hear no evil" class="emoji emoji-1f649" role="img" title="hear no evil">:hear_no_evil:</span></p>



<a name="216807086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216807086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216807086">(Nov 15 2020 at 18:41)</a>:</h4>
<p>like in <code>test.rs</code></p>



<a name="216807100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216807100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216807100">(Nov 15 2020 at 18:41)</a>:</h4>
<p>right now it's crashing in the standard library where things are complicated</p>



<a name="216807107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216807107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216807107">(Nov 15 2020 at 18:41)</a>:</h4>
<p>if you make it a standalone it might be more clear what's going on</p>



<a name="216807110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216807110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216807110">(Nov 15 2020 at 18:42)</a>:</h4>
<p>ah cool</p>



<a name="216808101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808101">(Nov 15 2020 at 18:58)</a>:</h4>
<p>So with this <a href="http://test.rs">test.rs</a>:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="sd">/// links to [char]</span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>

<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>I get this backtrace:</p>
<div class="codehilite"><pre><span></span><code>thread &#39;rustc&#39; panicked at &#39;called `Option::unwrap()` on a `None` value&#39;, compiler/rustc_metadata/src/rmeta/decoder.rs:949:43
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: rustc_metadata::rmeta::decoder::&lt;impl rustc_metadata::creader::CrateMetadataRef&gt;::get_type
   4: rustc_metadata::rmeta::decoder::cstore_impl::provide_extern::type_of
   5: rustc_middle::ty::query::&lt;impl rustc_query_system::query::config::QueryAccessors&lt;rustc_middle::ty::context::TyCtxt&gt; for rustc_middle::ty::query::queries::type_of&gt;::compute
   6: rustc_query_system::dep_graph::graph::DepGraph&lt;K&gt;::with_task_impl
   7: rustc_data_structures::stack::ensure_sufficient_stack
   8: rustc_query_system::query::plumbing::get_query_impl
   9: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve
  10: rustdoc::passes::collect_intra_doc_links::LinkCollector::resolve_link
  11: &lt;rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder&gt;::fold_item
  12: &lt;alloc::vec::Vec&lt;T&gt; as alloc::vec::SpecFromIter&lt;T,I&gt;&gt;::from_iter
  13: rustdoc::fold::DocFolder::fold_crate
  14: rustdoc::passes::collect_intra_doc_links::collect_intra_doc_links
  15: rustc_session::utils::&lt;impl rustc_session::session::Session&gt;::time
  16: rustdoc::core::run_global_ctxt
  17: rustc_interface::passes::QueryContext::enter
  18: rustc_session::utils::&lt;impl rustc_session::session::Session&gt;::time
  19: rustc_interface::queries::&lt;impl rustc_interface::interface::Compiler&gt;::enter
  20: rustc_span::with_source_map
  21: rustc_interface::interface::create_compiler_and_run
  22: rustdoc::core::run_core
  23: rustdoc::main_options
  24: scoped_tls::ScopedKey&lt;T&gt;::set
  25: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</code></pre></div>
<p>and these logs (which I am now reading):</p>
<div class="codehilite"><pre><span></span><code>2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=links to [char]
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links resolving char as a macro in the module DefId(0:0 ~ test[8787])
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links char resolved to Ok((Path { span: test.rs:1:1: 1:1 (#0), segments: [PathSegment { ident: char#0, id: NodeId(18), args: None }], tokens: None }, PrimTy(Char))) in namespace TypeNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links got res in TypeNS: (PrimTy(Char), Some(&quot;char&quot;))
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links char resolved to Err(()) in namespace ValueNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links found no `::`, assumming char was correctly not in scope                                                                                                                 [66/1236]
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Searches for [`char`]s that match the given predicate.
2:rustc
2:rustc# Examples
2:rustc
2:rustc```
2:rustcassert_eq!(&quot;Hello world&quot;.find(char::is_uppercase), Some(0));
2:rustcassert_eq!(&quot;Hello world&quot;.find(|c| &quot;aeiou&quot;.contains(c)), Some(1));
2:rustc```
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links resolving char as a macro in the module DefId(2:8608 ~ core[fe86]::str::pattern)
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links char resolved to Ok((Path { span: test.rs:1:1: 1:1 (#0), segments: [PathSegment { ident: char#0, id: NodeId(21), args: None }], tokens: None }, PrimTy(Char))) in namespace TypeNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links got res in TypeNS: (PrimTy(Char), Some(&quot;char&quot;))
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links char resolved to Err(()) in namespace ValueNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links found no `::`, assumming char was correctly not in scope
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=**Stability note:** This impl does not yet exist, but we are
2:rustc&quot;reserving space&quot; to add it in the future. See
2:rustc[rust-lang/rust#64715][#64715] for details.
2:rustc
2:rustc[#64715]: https://github.com/rust-lang/rust/issues/64715
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=# Panics
2:rustc
2:rustcIn this implementation, the `to_string` method panics
2:rustcif the `Display` implementation returns an error.
2:rustcThis indicates an incorrect `Display` implementation
2:rustcsince `fmt::Write for String` never returns an error itself.
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Extends a collection with the contents of an iterator.
2:rustc
2:rustcAs this is the only required method for this trait, the [trait-level] docs
2:rustccontain more details.
2:rustc
2:rustc[trait-level]: Extend
2:rustc
2:rustc# Examples
2:rustc
2:rustcBasic usage:
2:rustc
2:rustc```
2:rustc// You can extend a String with some chars:
2:rustclet mut message = String::from(&quot;abc&quot;);
2:rustc
2:rustcmessage.extend([&#39;d&#39;, &#39;e&#39;, &#39;f&#39;].iter());
2:rustc
2:rustcassert_eq!(&quot;abcdef&quot;, &amp;message);
2:rustc```
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links resolving Extend as a macro in the module DefId(2:5205 ~ core[fe86]::iter::traits::collect)
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links Extend resolved to Ok((Path { span: test.rs:1:1: 1:1 (#0), segments: [PathSegment { ident: Extend#0, id: NodeId(24), args: None }], tokens: None }, Def(Trait, DefId(2:5219 ~ core
[fe86]::iter::traits::collect::Extend)))) in namespace TypeNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links got res in TypeNS: (Def(Trait, DefId(2:5219 ~ core[fe86]::iter::traits::collect::Extend)), None)
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links Extend resolved to Err(()) in namespace ValueNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links found no `::`, assumming Extend was correctly not in scope
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links intra-doc link to Extend resolved to Def(Trait, DefId(2:5219 ~ core[fe86]::iter::traits::collect::Extend))
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links saw kind Trait with disambiguator None
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Extends a collection with exactly one element.                                                                                                             [14/1236]
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Reserves capacity in a collection for the given number of additional elements.
2:rustc
2:rustcThe default implementation does nothing.
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Performs the conversion.
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Sets the child process&#39;s user ID. This translates to a
2:rustc`setuid` call in the child process. Failure in the `setuid`
2:rustccall will cause the spawn to fail.
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Similar to `uid`, but sets the group ID of the child process. This has
2:rustcthe same semantics as the `uid` field.
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Schedules a closure to be run just before the `exec` function is
2:rustcinvoked.
2:rustc
2:rustcThe closure is allowed to return an I/O error whose OS error code will
2:rustcbe communicated back to the parent and returned as an error from when
2:rustcthe spawn was requested.
2:rustc
2:rustcMultiple closures can be registered and they will be called in order of
2:rustctheir registration. If a closure returns `Err` then no further closures
2:rustcwill be called and the spawn operation will immediately return with a
2:rustcfailure.
2:rustc
2:rustc# Notes and Safety
2:rustc
2:rustcThis closure will be run in the context of the child process after a
2:rustc`fork`. This primarily means that any modifications made to memory on
2:rustcbehalf of this closure will **not** be visible to the parent process.
2:rustcThis is often a very constrained environment where normal operations
2:rustclike `malloc` or acquiring a mutex are not guaranteed to work (due to
2:rustcother threads perhaps still running when the `fork` was run).
2:rustc
2:rustcThis also means that all resources such as file descriptors and
2:rustcmemory-mapped regions got duplicated. It is your responsibility to make
2:rustcsure that the closure does not violate library invariants by making
2:rustcinvalid use of these duplicates.
2:rustc
2:rustcWhen this closure is run, aspects such as the stdio file descriptors and
2:rustcworking directory have successfully been changed, so output to these
2:rustclocations may not appear where intended.
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links combined_docs=Schedules a closure to be run just before the `exec` function is
2:rustcinvoked.
2:rustc
2:rustcThis method is stable and usable, but it should be unsafe. To fix
2:rustcthat, it got deprecated in favor of the unsafe [`pre_exec`].
2:rustc
2:rustc[`pre_exec`]: CommandExt::pre_exec
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links resolving CommandExt::pre_exec as a macro in the module DefId(1:9082 ~ std[7f8a]::sys::unix::ext::process)
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links CommandExt::pre_exec resolved to Err(()) in namespace TypeNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links CommandExt resolved to Ok((Path { span: test.rs:1:1: 1:1 (#0), segments: [PathSegment { ident: CommandExt#0, id: NodeId(30), args: None }], tokens: None }, Def(Trait, DefId(1:909
7 ~ std[7f8a]::sys::unix::ext::process::CommandExt)))) in namespace TypeNS
2:rustcDEBUG rustdoc::passes::collect_intra_doc_links looking for associated item named pre_exec for item DefId(1:9097 ~ std[7f8a]::sys::unix::ext::process::CommandExt)
thread &#39;rustc&#39; panicked at &#39;called `Option::unwrap()` on a `None` value&#39;, compiler/rustc_metadata/src/rmeta/decoder.rs:949:43
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
</code></pre></div>



<a name="216808120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808120">(Nov 15 2020 at 18:58)</a>:</h4>
<p>oh ok, so not related to primitives</p>



<a name="216808130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808130">(Nov 15 2020 at 18:59)</a>:</h4>
<p>I think this unwrap is from <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/rmeta/decoder.rs#L950">https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/rmeta/decoder.rs#L950</a></p>



<a name="216808190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808190">(Nov 15 2020 at 19:00)</a>:</h4>
<p>ah hmm so I think my proposed fix was wrong in the first place</p>



<a name="216808197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808197">(Nov 15 2020 at 19:00)</a>:</h4>
<p>traits are not types, this is coming from calling <code>traits_implemented_by</code> on a trait</p>



<a name="216808198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808198">(Nov 15 2020 at 19:00)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/603ab5bd6e0ffefafa7411cd8bd23a6ca82bcff0/src/librustdoc/passes/collect_intra_doc_links.rs#L729">https://github.com/rust-lang/rust/blob/603ab5bd6e0ffefafa7411cd8bd23a6ca82bcff0/src/librustdoc/passes/collect_intra_doc_links.rs#L729</a></p>



<a name="216808213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808213">(Nov 15 2020 at 19:01)</a>:</h4>
<p>I would try adding just the variants you need to fix the bug and I can think about how to make this nicer in a follow-up</p>



<a name="216808217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808217">(Nov 15 2020 at 19:01)</a>:</h4>
<p>in this case I think <code>ForeignTy</code> is the one you want</p>



<a name="216808219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808219">(Nov 15 2020 at 19:01)</a>:</h4>
<p>Ah I see -- sounds like a good shout!</p>



<a name="216808222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808222">(Nov 15 2020 at 19:01)</a>:</h4>
<p>giving that a go now</p>



<a name="216808228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808228">(Nov 15 2020 at 19:01)</a>:</h4>
<p>and maybe I'll also change that unwrap(), it's not very helpful</p>



<a name="216808245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808245">(Nov 15 2020 at 19:02)</a>:</h4>
<p>Yes good shout</p>



<a name="216808306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808306">(Nov 15 2020 at 19:03)</a>:</h4>
<p>It's quite possible I'll need more help, but just giving a pre-emptive thank you for the help so far :)</p>



<a name="216808313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808313">(Nov 15 2020 at 19:04)</a>:</h4>
<p>you're very welcome :) it's nice to have people helping out</p>



<a name="216808437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808437">(Nov 15 2020 at 19:07)</a>:</h4>
<p>The suggested fix with <code>ForeignTy</code> does indeed work <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span> Does it make sense to include changing the <code>unwrap</code> in the same PR?</p>



<a name="216808446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808446">(Nov 15 2020 at 19:07)</a>:</h4>
<p>sure, that works too - this is my fix:</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs</span>
<span class="gh">index a1df1a63fc5..f949391752b 100644</span>
<span class="gd">--- a/compiler/rustc_metadata/src/rmeta/decoder.rs</span>
<span class="gi">+++ b/compiler/rustc_metadata/src/rmeta/decoder.rs</span>
<span class="gu">@@ -947,7 +947,9 @@ fn get_generics(&amp;self, item_id: DefIndex, sess: &amp;Session) -&gt; ty::Generics {</span>
     }

     fn get_type(&amp;self, id: DefIndex, tcx: TyCtxt&lt;'tcx&gt;) -&gt; Ty&lt;'tcx&gt; {
<span class="gd">-        self.root.tables.ty.get(self, id).unwrap().decode((self, tcx))</span>
<span class="gi">+        self.root.tables.ty.get(self, id)</span>
<span class="gi">+          .unwrap_or_else(|| panic!("not a type: {:?}", id))</span>
<span class="gi">+          .decode((self, tcx))</span>
     }

     fn get_stability(&amp;self, id: DefIndex) -&gt; Option&lt;attr::Stability&gt; {
</code></pre></div>



<a name="216808449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808449">(Nov 15 2020 at 19:07)</a>:</h4>
<p>please test out the new error message is helpful though</p>



<a name="216808492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808492">(Nov 15 2020 at 19:08)</a>:</h4>
<p>if the debug output for <code>id</code> is unhelpful you can turn it into a DefId with <code>DefId::from_local</code></p>



<a name="216808495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216808495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216808495">(Nov 15 2020 at 19:08)</a>:</h4>
<p>(I think)</p>



<a name="216813615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216813615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216813615">(Nov 15 2020 at 20:50)</a>:</h4>
<p>I should have asked earlier, but is there somewhere I should add a test for the fix with <code>ForeignTy</code>?</p>



<a name="216814971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216814971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216814971">(Nov 15 2020 at 21:20)</a>:</h4>
<p>yes, in <code>src/test/rustdoc</code></p>



<a name="216814973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216814973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216814973">(Nov 15 2020 at 21:21)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/rustdoc-internals.html#dotting-is-and-crossing-ts">https://rustc-dev-guide.rust-lang.org/rustdoc-internals.html#dotting-is-and-crossing-ts</a></p>



<a name="216814982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216814982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216814982">(Nov 15 2020 at 21:21)</a>:</h4>
<p>there are other examples, anything starting with <code>intra-link</code> should be relevant</p>



<a name="216815106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216815106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hannah McLaughlin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216815106">(Nov 15 2020 at 21:24)</a>:</h4>
<p>Thanks -- I'll hopefully have the PR ready on Tuesday (I'm busy tomorrow evening) with tests. </p>
<p>FYI, for the <a href="http://decoder.rs">decoder.rs</a> change, doing <code>DefId::local(id)</code> caused a panic because the index was not valid:<br>
<code>thread 'rustc' panicked at 'index out of bounds: the len is 5 but the index is 8624', compiler/rustc_hir/src/definitions.rs:47:9</code></p>
<p>Perhaps this is the best we can do? <code>thread 'rustc' panicked at 'Not a type: DefIndex(8624)', compiler/rustc_metadata/src/rmeta/decoder.rs:951:32</code> let me know if you have any other suggestions :)</p>



<a name="216815254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216815254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216815254">(Nov 15 2020 at 21:29)</a>:</h4>
<p>hmm, I don't know rustc_metadata well enough to have better suggestions</p>



<a name="216815259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Debugging%20rustdoc%20with%20gdb%20--%20no%20debug%20symbols%3F/near/216815259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Debugging.20rustdoc.20with.20gdb.20--.20no.20debug.20symbols.3F.html#216815259">(Nov 15 2020 at 21:29)</a>:</h4>
<p>seems fine for now though</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>